home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 27 / CDROM27.iso / share / progra / mai / Application, Lauching another < prev    next >
Encoding:
Text File  |  1997-07-15  |  783 b   |  28 lines

  1. 'Description: Shell Function. Runs an executable program. Wait for program to
  2. '             terminate. Time out after 30 seconds.
  3.  
  4. 'Declare Function GetModuleUsage Lib "Kernel" (ByVal hModule As Integer) As Integer
  5. 'Const SW_HIDE = 0      'Normal Window
  6. 'Const SW_NORMAL = 1    'Maximized Window
  7. 'Const SW_MAXIMIZE = 3  'Minimized Window
  8. 'Const SW_MINIMIZE = 6  'Hidden Window
  9.  
  10. 'Sub Command1_Click ()
  11. On Error Resume Next
  12. command1.Enabled = False
  13. iInst% = Shell("C:\TEST\DOSAPP.EXE", SW_MINIMIZE)
  14. startt! = Timer
  15. timeout% = False
  16. Do While GetModuleUsage(iInst%) > 0
  17.  DoEvents
  18.   If Abs(Timer - startt!) > 30 Then
  19.   timeout% = True
  20.  Exit Do
  21. End If
  22. Loop
  23.  
  24. If timeout% Then MsgBox "Timed out, 30 seconds passed!", 0, "Warning"
  25. command1.Enabled = True
  26. 'End Sub
  27.  
  28.